package mvp.com.register.model.impl;

import mvp.com.register.model.IUserBiz;
import mvp.com.register.model.bean.User;
import mvp.com.register.view.IRegisterView;

/**
 * Created by YoungerChen on 2016/9/13.
 */
public class UserBiz implements IUserBiz {

    @Override
    public void register(final User user, final IRegisterView.OnRegisterListener registerListener) {

        new Thread(){
            @Override
            public void run() {
                String username = user.getUsername();
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

                if ("".equals(username)) {
                    registerListener.registerFailed();
                } else {
                    registerListener.registerSuccess(user);
                }

            }
        }.start();

    }
}
